import requests from "./request";
import mockAjax from "./mockAjax";

//首页三级分类
//api/product/getBaseCategoryList
export const baseCategoryList = () => requests({ url: '/product/getBaseCategoryList' },)

//获取轮播图信息
//mock/getBannerList
export const getBannerList = () => mockAjax({ url: '/banners' })

//获取楼层数据
export const getFloorList = () => mockAjax({ url: '/floors' })

//搜索商品
export const getSearchList = (data = {}) => requests({ url: '/list', method: 'POST', data })

//详情页面商品信息
export const getCurrentGood = (skuId) => requests({ url: `/item/${skuId}`, method: 'get' })

//添加到购物车
export const addToShoppingCar = (skuId, skuNum) => requests({ url: `/cart/addToCart/${skuId}/${skuNum}`, method: 'POST' })

//购物车列表
export const getCarList = () => requests({ url: "/cart/cartList" })

//删除购物车商品
export const deleteShopping = (skuId) => requests({ url: `/cart/deleteCart/${skuId}`, method: "DELETE" })

//修改购物车商品选中状态
export const checkCart = (skuId, isChecked) => requests({ url: `/cart/checkCart/${skuId}/${isChecked}`, method: 'get' })

//获取验证码
export const getCode = (phone) => requests({ url: `/user/passport/sendCode/${phone}`, method: 'get' })

//注册用户
export const regUser = (data) => requests({ url: `/user/passport/register`, method: 'post', data })

//用户登录
export const regUserLogin = (data) => requests({ url: `/user/passport/login`, method: 'post', data })

//用户信息
export const getUInfo = () => requests({ url: `/user/passport/auth/getUserInfo`, method: 'get' })

///user/passport/logout 退出登录
export const userLogout = () => requests({ url: `/user/passport/logout`, method: 'get' })

//获取订单交易页信息
export const getUserAddressList = () => requests({ url: `/order/auth/trade`, method: 'get' })

//获取我的订单列表
export const getMyRecords = (page, limit) => requests({ url: `/order/auth/${page}/${limit}`, method: 'get' })

//提交订单
export const submitOrder = (tradeNo, data) => requests({ url: `/order/auth/submitOrder?tradeNo=${tradeNo}`, method: 'post', data })

//获取订单信息
export const getOrderInfo = (orderId) => requests({ url: `/payment/weixin/createNative/${orderId}`, method: 'get' })

//获取订单支付信息
export const getOrderPay = (orderId) => requests({ url: `/payment/weixin/createNative/${orderId}`, method: 'get' })